<!DOCTYPE HTML>
<html xmlns:th="http://www.thymeleaf.org">
<head th:include="_meta :: header">
    <title>编辑</title>
</head>
<body>
<div class="layui-fluid">
    <div class="layui-row">
        <form class="layui-form form form-horizontal" id="form-maintainapply-edit" action="#"
              th:action="@{/maintainapply/maintainapply/edit}"
              th:object="${maintainapply}" enctype="multipart/form-data">
            <input type="hidden" name="id" th:value="${maintainapply.id}"/>

                    <div class="layui-form-item">
                        <label class="layui-form-label"><span
                                    class="c-red">*</span>设备编号：</label>
                            <div class="layui-input-inline">
                                    <input type="text" class="layui-input"
                                           th:value="${maintainapply.equId}"
                                           name="equId" placeholder="修改设备编号"
                                           id="equId"/>

                            </div>
                    </div>

                    <div class="layui-form-item">
                        <label class="layui-form-label"><span
                                    class="c-red">*</span>设备名称：</label>
                            <div class="layui-input-inline">
                                    <input type="text" class="layui-input"
                                           th:value="${maintainapply.equName}"
                                           name="equName" placeholder="修改设备名称"
                                           id="equName"/>

                            </div>
                    </div>

                    <div class="layui-form-item">
                        <label class="layui-form-label"><span
                                    class="c-red">*</span>设备型号：</label>
                            <div class="layui-input-inline">
                                    <input type="text" class="layui-input"
                                           th:value="${maintainapply.equType}"
                                           name="equType" placeholder="修改设备型号"
                                           id="equType"/>

                            </div>
                    </div>

                    <div class="layui-form-item">
                        <label class="layui-form-label"><span
                                    class="c-red">*</span>申请维修人id：</label>
                            <div class="layui-input-inline">
                                    <input type="text" class="layui-input"
                                           th:value="${maintainapply.porposerId}"
                                           name="porposerId" placeholder="修改申请维修人id"
                                           id="porposerId"/>

                            </div>
                    </div>

                    <div class="layui-form-item">
                        <label class="layui-form-label"><span
                                    class="c-red">*</span>申请时间：</label>
                            <div class="layui-input-inline">
                                <input type="text" class="layui-input timeSpace" readonly="readonly" autocomplete="off"
                                       th:value="${#temporals.format(maintainapply.equCreatetime, 'yyyy-MM-dd HH:mm:ss')}"
                                       name="equCreatetime" placeholder="请选择申请时间"/>
                            </div>
                    </div>

                    <div class="layui-form-item">
                        <label class="layui-form-label"><span
                                    class="c-red">*</span>申请状态（申请中，维修中，维修完成）：</label>
                            <div class="layui-input-inline">
                                    <input type="text" class="layui-input"
                                           th:value="${maintainapply.status}"
                                           name="status" placeholder="修改申请状态（申请中，维修中，维修完成）"
                                           id="status"/>

                            </div>
                    </div>

                    <div class="layui-form-item">
                        <label class="layui-form-label"><span
                                    class="c-red">*</span>故障原因：</label>
                            <div class="layui-input-inline">
                                    <input type="text" class="layui-input"
                                           th:value="${maintainapply.faultCause}"
                                           name="faultCause" placeholder="修改故障原因"
                                           id="faultCause"/>

                            </div>
                    </div>

                    <div class="layui-form-item">
                        <label class="layui-form-label"><span
                                    class="c-red">*</span>备注信息：</label>
                            <div class="layui-input-inline">
                                    <input type="text" class="layui-input"
                                           th:value="${maintainapply.maintainRemake}"
                                           name="maintainRemake" placeholder="修改备注信息"
                                           id="maintainRemake"/>

                            </div>
                    </div>

            <div class="layui-form-item">
                <label class="layui-form-label">
                </label>
                <button class="layui-btn" id="subbtn" type="submit">
                    增加
                </button>
                <button class="layui-btn" id="reset" type="reset">
                    重置
                </button>
            </div>
        </form>
    </div>
</div>
<!--_footer 作为公共模版分离出去-->
<div th:replace="_footer :: footerjs"></div>
<div th:replace="_ueditor :: ueditor"></div>
<!--/_footer 作为公共模版分离出去-->
<!--请在下方写此页面业务相关的脚本-->
<script>
    layui.use(['form', 'layer', 'laydate'], function () {
        $ = layui.jquery;
        var form = layui.form,
            laydate = layui.laydate,
            layer = layui.layer;
        lay('.timeSpace').each(function () {
            laydate.render({
                elem: this
                , trigger: 'click'
                , type: 'datetime'
            });
        });
    });
    $(function () {
        $("#form-maintainapply-edit").validate({
            rules: {
        equId:
        {
            required: true,
        }
    ,
        equName:
        {
            required: true,
        }
    ,
        equType:
        {
            required: true,
        }
    ,
        porposerId:
        {
            required: true,
        }
    ,
        equCreatetime:
        {
            required: true,
        }
    ,
        status:
        {
            required: true,
        }
    ,
        faultCause:
        {
            required: true,
        }
    ,
        maintainRemake:
        {
            required: true,
        }
    ,
    },
        onkeyup:false,
            debug
    :
        true,
            success
    :
        "valid",
            submitHandler
    :

        function (form) {
            $(form).ajaxSubmit({
                type: 'POST',
                url: "/maintainapply/maintainapply/edit",
                success: function (data) {
                    if (data.code == "1") {
                        selfmsg('编辑成功!', 1, function () {
                            var index = parent.layer.getFrameIndex(window.name);
                            parent.location.reload();
                            parent.layer.close(index);
                        });
                    } else {
                        selfmsg('编辑失败!');
                    }
                },
                error: function () {
                    selfmsg('编辑异常!', 5);
                }
            });
        }
    })
        ;
    });

</script>
<!--/请在上方写此页面业务相关的脚本-->
</body>
</html>